package com.project.controller;

import com.project.bean.CommentBean;
import com.project.service.ICommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@SuppressWarnings("all")
@RestController
@RequestMapping("comment")
public class CommentController {
    @Autowired
    ICommentService service;

    /**
     * 发布评论
     *
     * @param themeId 评论对象
     * @return 最新的评论集合
     */
    @RequestMapping("add")
    public List<CommentBean> add(String name, String content, Integer userId, Integer themeId) {
        CommentBean comment = new CommentBean(name, content, userId, themeId);
        return service.add(comment, themeId);
    }

}
